Visualizing raw trial looking time

d_no_target <- d %>% 
  filter(trial_stimulus_type != "target")

Looking time distribution

RAW

data_with_demog %>% 
  ggplot(aes(x = trial_looking_time)) + 
  geom_histogram(bins = 90) + 
  xlim(0, 9000)
## Warning: Removed 72 rows containing non-finite values (stat_bin).
## Warning: Removed 2 rows containing missing values (geom_bar).

data_with_demog %>% 
  ggplot(aes(x = trial_looking_time)) + 
  geom_histogram(bins = 90) + 
  xlim(0, 9000) + 
  facet_wrap(~subject)
## Warning: Removed 72 rows containing non-finite values (stat_bin).
## Warning: Removed 134 rows containing missing values (geom_bar).

AFTER EXCLUSION

d %>% 
  ggplot(aes(x = trial_looking_time)) + 
  geom_histogram(bins = 90) + 
  xlim(0, 6000)
## Warning: Removed 2 rows containing missing values (geom_bar).

d %>% 
  ggplot(aes(x = trial_looking_time)) + 
  geom_histogram(bins = 90) + 
  xlim(0, 6000) + 
  facet_wrap(~subject)
## Warning: Removed 84 rows containing missing values (geom_bar).

Exclude the target trial

d_no_target %>% 
  ggplot(aes(x = trial_looking_time)) + 
  geom_histogram(bins = 90) + 
  xlim(0, 6000)
## Warning: Removed 2 rows containing missing values (geom_bar).

d_no_target %>% 
  ggplot(aes(x = trial_looking_time)) + 
  geom_histogram(bins = 90) + 
  xlim(0, 6000) + 
  facet_wrap(~subject)
## Warning: Removed 84 rows containing missing values (geom_bar).

complexity difference

d %>% 
  ggplot(aes(x = trial_looking_time, 
            fill = trial_stimulus_complexity), 
         ) + 
  geom_density(alpha = 0.5)+ 
  xlim(0, 6000)

d %>% 
  ggplot(aes(x = trial_looking_time, 
            fill = trial_stimulus_complexity), 
         ) + 
  geom_density(alpha = 0.5)+ 
  xlim(0, 6000) + 
  facet_wrap(~subject)

block difference

d %>% 
  ggplot(aes(x = trial_looking_time, 
            fill = block), 
         ) + 
  geom_density(alpha = 0.5)+ 
  xlim(0, 6000)

d %>% 
  ggplot(aes(x = trial_looking_time, 
            fill = block), 
         ) + 
  geom_density(alpha = 0.5)+ 
  xlim(0, 6000) + 
  facet_wrap(~subject)

Complexity differences no target

d_no_target %>% 
  ggplot(aes(x = trial_looking_time, 
            fill = trial_stimulus_complexity), 
         ) + 
  geom_density(alpha = 0.5)+ 
  xlim(0, 6000)

d_no_target %>% 
  ggplot(aes(x = trial_looking_time, 
            fill = trial_stimulus_complexity), 
         ) + 
  geom_density(alpha = 0.5)+ 
  xlim(0, 6000) + 
  facet_wrap(~subject)

Block differences no target

d_no_target %>% 
  ggplot(aes(x = trial_looking_time, 
            fill = block), 
         ) + 
  geom_density(alpha = 0.5)+ 
  xlim(0, 6000)

d_no_target %>% 
  ggplot(aes(x = trial_looking_time, 
            fill = block), 
         ) + 
  geom_density(alpha = 0.5)+ 
  xlim(0, 6000) + 
  facet_wrap(~subject)
## Warning: Groups with fewer than two data points have been dropped.
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning -
## Inf

Visualizing aggregarded looking time

d_sum_individual <- d %>% 
  group_by(subject, block) %>% 
  summarise(
    mean_lt = mean(trial_looking_time, na.rm = TRUE), 
    sd = sd(trial_looking_time, na.rm = TRUE), 
    n = n(), 
    ci_range_95 = qt(1 - (0.05 / 2), n - 1) * (sd/sqrt(n)), 
    ci_ub = mean_lt + ci_range_95, 
    ci_lb = mean_lt - ci_range_95
  )
## `summarise()` regrouping output by 'subject' (override with `.groups` argument)
d_sum <- d %>% 
  group_by(block) %>% 
  summarise(
    mean_lt = mean(trial_looking_time, na.rm = TRUE), 
    sd = sd(trial_looking_time, na.rm = TRUE), 
    n = n(), 
    ci_range_95 = qt(1 - (0.05 / 2), n - 1) * (sd/sqrt(n)), 
    ci_ub = mean_lt + ci_range_95, 
    ci_lb = mean_lt - ci_range_95
  )
## `summarise()` ungrouping output (override with `.groups` argument)

aggregated

d_sum %>% ggplot(aes(x = block, y = mean_lt)) + 
  geom_pointrange(aes(ymin = ci_lb, ymax = ci_ub)) + 
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))

individual

something weird happened

d_sum_individual %>% 
  ggplot(aes(x = block, y = mean_lt)) + 
  geom_pointrange(aes(ymin = ci_lb, ymax = ci_ub)) +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))

d_sum_individual %>% 
  ggplot(aes(x = block, y = mean_lt)) + 
  geom_pointrange(aes(ymin = ci_lb, ymax = ci_ub))  + 
  facet_wrap(~subject) + 
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))

weird ones

We can see three very weird ones: SS1604513317537 SS1604515995769 SS1604516882157

weird <- c("SS1604513317537", 
           "SS1604515995769", 
           "SS1604516660396")

d_sum_individual %>% 
  filter(subject %in% weird) %>% 
  ggplot(aes(x = block, y = mean_lt)) + 
  geom_pointrange(aes(ymin = ci_lb, ymax = ci_ub))  + 
  facet_wrap(~subject) + 
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))

d %>% 
  filter(subject %in% weird) %>% 
  ggplot(aes(x = trial_looking_time)) + 
  geom_histogram(bins = 90) +
  facet_wrap(~subject) + 
  xlim(0, 6000)+
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))
## Warning: Removed 6 rows containing missing values (geom_bar).

Excluding weird ones

d_no_weird <- d %>% 
  filter(!(subject %in% weird)) 

  
d_no_weird_sum <- d_no_weird %>% 
  group_by(block) %>% 
  summarise(
    mean_lt = mean(trial_looking_time, na.rm = TRUE), 
    sd = sd(trial_looking_time, na.rm = TRUE), 
    n = n(), 
    ci_range_95 = qt(1 - (0.05 / 2), n - 1) * (sd/sqrt(n)), 
    ci_ub = mean_lt + ci_range_95, 
    ci_lb = mean_lt - ci_range_95
  )
## `summarise()` ungrouping output (override with `.groups` argument)
d_no_weird_sum %>% ggplot(aes(x = block, y = mean_lt)) + 
  geom_pointrange(aes(ymin = ci_lb, ymax = ci_ub)) + 
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))

# Basic model

null_m <- lmer(trial_looking_time ~ 1 + (1|subject), 
               data = d)

basic_m <- lmer(trial_looking_time ~ block + (1|subject), 
     data = d)

anova(null_m, basic_m)
## refitting model(s) with ML (instead of REML)
## Data: d
## Models:
## null_m: trial_looking_time ~ 1 + (1 | subject)
## basic_m: trial_looking_time ~ block + (1 | subject)
##         Df    AIC    BIC logLik deviance  Chisq Chi Df Pr(>Chisq)   
## null_m   3 121133 121154 -60563   121127                            
## basic_m  6 121126 121167 -60557   121114 13.076      3   0.004474 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

TODO:

  • age, SES, gender

number of background repetition on looking time

full, aggregated, by complexity

full_aggregated <- d %>% 
  mutate(
    number = 1) %>% 
  group_by(
  subject, block, trial_stimulus_type
  ) %>% 
  mutate(num_times_stimulus_seen = cumsum(number))

full_aggregated %>% 
  filter(trial_stimulus_type == "background") %>% 
  ggplot(
    aes(y = log(trial_looking_time), 
        x = num_times_stimulus_seen,
        color = trial_stimulus_complexity)
  ) + 
  geom_point(aes(alpha = 0.2), size = 3, shape = ".") + 
  guides(alpha = FALSE) + 
  labs(color = "Stimulus Complexity") + 
  ylab("Mean Looking Time (log)") + 
  xlab("Number of Stimulus Reptitions") + 
  geom_smooth(method = "lm") + 
  theme(axis.text = element_text(size = 10))
## `geom_smooth()` using formula 'y ~ x'

full, aggregated, by blocks

full_aggregated %>% 
  filter(trial_stimulus_type == "background") %>% 
  ggplot(
    aes(y = log(trial_looking_time), 
        x = num_times_stimulus_seen,
        color = block)
  ) + 
  geom_point(aes(alpha = 0.2), size = 3, shape = ".") + 
  guides(alpha = FALSE) + 
  labs(color = "Stimulus Complexity") + 
  ylab("Mean Looking Time (log)") + 
  xlab("Number of Stimulus Reptitions") + 
  geom_smooth(method = "lm") + 
  theme(axis.text = element_text(size = 10))
## `geom_smooth()` using formula 'y ~ x'

no weird, aggregated, by complexity

excluded_sum <- full_aggregated %>% 
  filter(trial_stimulus_type == "background") %>% 
  filter(!(subject %in% weird))

excluded_sum %>% 
  ggplot(
    aes(y = log(trial_looking_time), 
        x = num_times_stimulus_seen,
        color = trial_stimulus_complexity)
  ) + 
  geom_point(aes(alpha = 0.2), size = 3, shape = ".") + 
  guides(alpha = FALSE) + 
  labs(color = "Stimulus Complexity") + 
  ylab("Mean Looking Time (log)") + 
  xlab("Number of Stimulus Reptitions") + 
  geom_smooth(method = "lm") + 
  theme(axis.text = element_text(size = 10))
## `geom_smooth()` using formula 'y ~ x'

no weird, aggregated, by blocks

excluded_sum %>% 
  ggplot(
    aes(y = log(trial_looking_time), 
        x = num_times_stimulus_seen,
        color = block)
  ) + 
  geom_point(aes(alpha = 0.2), size = 3, shape = ".") + 
  guides(alpha = FALSE) + 
  labs(color = "Stimulus Complexity") + 
  ylab("Mean Looking Time (log)") + 
  xlab("Number of Stimulus Reptitions") + 
  geom_smooth(method = "lm") + 
  theme(axis.text = element_text(size = 10))
## `geom_smooth()` using formula 'y ~ x'

individual, by complexity

full_aggregated %>% 
  filter(trial_stimulus_type == "background") %>% 
  ggplot(
    aes(y = log(trial_looking_time), 
        x = num_times_stimulus_seen,
        color = trial_stimulus_complexity)
  ) + 
  geom_point(aes(alpha = 0.2), size = 3, shape = ".") + 
  guides(alpha = FALSE) + 
  labs(color = "Stimulus Complexity") + 
  ylab("Mean Looking Time (log)") + 
  xlab("Number of Stimulus Reptitions") + 
  geom_smooth(method = "lm") + 
  theme(axis.text = element_text(size = 10)) + 
  facet_wrap(~subject)
## `geom_smooth()` using formula 'y ~ x'

individual, by block

full_aggregated %>% 
  filter(trial_stimulus_type == "background") %>% 
  ggplot(
    aes(y = log(trial_looking_time), 
        x = num_times_stimulus_seen,
        color = block)
  ) + 
  geom_point(aes(alpha = 0.2), size = 3, shape = ".") + 
  guides(alpha = FALSE) + 
  labs(color = "Stimulus Complexity") + 
  ylab("Mean Looking Time (log)") + 
  xlab("Number of Stimulus Reptitions") + 
  geom_smooth(method = "lm") + 
  theme(axis.text = element_text(size = 10)) + 
  facet_wrap(~subject)
## `geom_smooth()` using formula 'y ~ x'

target reaction time predictive of anything?

import the complexity norm